/* eslint-disable no-use-before-define */

import axios, { type Paging, type Response } from '@/utils/axios/axios';

/** 申请成为合作方 */
export function applyCooperationAxios(data: { phone: number | string; applyReason: string }): Promise<Response<string>> {
  return axios.post(`/app/partnerApply/apply`, data) as Promise<Response<string>>;
}
/** 申请成为合作方 */
export function queryApplyCooperationResultAxios(): Promise<Response<ApplyCooperationResult | null>> {
  return axios.get(`/app/partnerApply/getDetailInfo`) as Promise<Response<ApplyCooperationResult | null>>;
}

/** 合作收益 */
export function queryCooperationEarningsAxios(current: number, size: number): Promise<Response<Paging<CooperationEarnings>>> {
  return axios.get(`/app/dramaIncome/getDramaEverydayIncome`, { data: { current, size } }) as Promise<Response<Paging<CooperationEarnings>>>;
}

export type CooperationEarnings = {
  /** 日期时间戳  */
  dateTimeStamp: number;
  /** 导演 */
  director: string;
  /** 短剧id  */
  dramaId: number;
  /** 短剧封面图 */
  dramaCover: string;
  /** 短剧名称 */
  dramaTitle: string;
  /** 演员 */
  performer: string;
  /** 总收入金额  */
  totalAmount: number;
  /** 第几集 */
  episodeSeq: number;
  /** 剧集 ID */
  episodeId: number;
  /** 第三方剧集id */
  thirdEpisodeId?: string;
  /** 第三方短剧id */
  thirdDramaId?: string;
  /** 提审方appid */
  srcAppid: string;
};

export type ApplyCooperationResult = {
  /** 申请主键ID */
  applyId: number;
  /** 申请理由 */
  applyReason: string;
  /** 手机号  */
  phone: string;
  /** 原因 */
  remark: string;
  /** 审核状态：0-待审核；1-通过；2-驳回； */
  status: 0 | 1 | 2;
  /** app用户ID */
  userId: number;
};
